package com.hunlian.makelove.net.api;

import android.content.Context;
import android.util.Log;

import com.google.gson.Gson;
import com.hunlian.makelove.bean.CheckPhoneBean;
import com.hunlian.makelove.net.InterfaceServiceVisit;
import com.hunlian.makelove.net.ResponseCallbackListener;
import com.hunlian.makelove.net.ServiceInterfaceDef;
import com.hunlian.makelove.net.StringResponseCallbackListener;


/**
 * 查看对方电话
 * @author zealjiang
 * @time 2016/12/20 10:04
 */
public class CheckPhoneServiceVisit extends InterfaceServiceVisit {

	public CheckPhoneServiceVisit(Context context) {
		super(context);

		setFunctionId(ServiceInterfaceDef.FUNC_ID_CHECK_PHONE);
	}

	//参数
	public void setParamters(String userId,String tarId) {
		paramterData.put("userId", userId);
		paramterData.put("tarId", tarId);
	}

	public void getResult(final ResponseCallbackListener<CheckPhoneBean,Object> listener) {
		doPost(getParamter(), new StringResponseCallbackListener() {
			@Override
			public void onSuccess(String data) {
				Log.e("CheckPhoneServiceVisit",data);
				Gson gson = new Gson();
				CheckPhoneBean bean = gson.fromJson(data, CheckPhoneBean.class);

				if (listener != null) {
					listener.onSuccess(bean);
				}
			}

			@Override
			public void onFailure(String errCode, String errMessage,String str) {
				if (listener != null) {
					listener.onFailure(errCode, errMessage,str);
				}
			}
		});
	}


}
